5  Independent-Samples t-tests

Sample Problems

5.1 About

the independent-samples t-Test problems use the RamdomData class which requires:

  • the groups variable set to 2: groups = 2
  • the sample size per group - all groups will have the same sample size
  • a call to the independent_samples_t_test() method

In these sample problems, the per-group sample size is randomly set between 5 and 15. An example funciton call is included below

sample_size = random.randint(5,15)
RandomData(groups = 2, n = sample_size).independent_samples_t_test()

5.2 Problem 1

Given the following between-subjects data, is the mean of \(Group_A\) significantly different from the mean of \(Group_B\)? Use a \({2}\) tailed-test with \(\alpha = {0.05}\)

A B
62 78
61 64
63 74
73 89
62 72
66 79
55 79


The necessary summary Statistis for these data:
\[M_A = {63.14}, M_B = {76.43}\] \[SS_A = {178.86}, SS_B = {353.71}\] \[n_A = {7}, n_B = {7}\]

State the Hypotheses
\[H_0: \mu_A - \mu_B = 0\] \[H_1: \mu_A - \mu_B \ne 0\]


The decision criteria:

\(t_{crit} = \pm{2.18}, \alpha_{two-tailed} = {0.05}, df = {12}\)

Calculate the pooled variance:
\[s_p^2 = {\frac{SS_A + SS_B}{df_A + df_B}}\]
\[s_p^2 = {\frac{178.86 + 353.71}{6 + 6}}\]
\[s_p^2 = \frac{532.57}{12}\]
\[s_p^2 = {44.38}\]

Calculate the estimated error of the difference between means: \(s_{(M_A - M_B)}\)
\[s_{(M_A - M_B)} = \sqrt{\frac{s_p^2}{n_1} + \frac{s_p^2}{n_1}}\]
\[s_{(M_A - M_B)} = \sqrt{\frac{44.38}{7} + \frac{44.38}{7}}\]
\[s_{(M_A - M_B)} = \sqrt{6.34 + 6.34}\]
\[s_{(M_A - M_B)} = \sqrt{12.68}\]
\[s_{(M_A - M_B)} = {3.56}\]

Calculate \(t_{obt}\)
\[t_{obt} = {\frac{(M_A - M_B) - (\mu_A - \mu_B)}{s_{(M_A - M_B)}}}\]
\[t_{obt} = \frac{(63.14 - 76.43) - {0}}{3.56}\]
\[t_{obt} = \frac{-13.29}{3.56}\]
\[t_{obt} = {-3.73}\]

Calculate Cohen’s d
\[d = \frac{M_A - M_B}{\sqrt{s_p^2}}\]
\[d = \frac{(63.14 - 76.43)}{{{\sqrt{44.38}}}}\]
\[d = \frac{(-13.29)}{6.66}\]
\[d = {-2.0}\]

The results:

reject the null hypothesis, results are significant,
t(12) = -3.73, p < 0.05, d = -2.0

5.3 Problem 2

Given the following between-subjects data, is the mean of \(Group_A\) significantly different from the mean of \(Group_B\)? Use a \({2}\) tailed-test with \(\alpha = {0.01}\)

A B
14 15
15 10
15 15
14 11
14 19
17 9


The necessary summary Statistis for these data:
\[M_A = {14.83}, M_B = {13.17}\] \[SS_A = {6.83}, SS_B = {72.83}\] \[n_A = {6}, n_B = {6}\]

State the Hypotheses
\[H_0: \mu_A - \mu_B = 0\] \[H_1: \mu_A - \mu_B \ne 0\]


The decision criteria:

\(t_{crit} = \pm{3.17}, \alpha_{two-tailed} = {0.01}, df = {10}\)

Calculate the pooled variance:
\[s_p^2 = {\frac{SS_A + SS_B}{df_A + df_B}}\]
\[s_p^2 = {\frac{6.83 + 72.83}{5 + 5}}\]
\[s_p^2 = \frac{79.66}{10}\]
\[s_p^2 = {7.97}\]

Calculate the estimated error of the difference between means: \(s_{(M_A - M_B)}\)
\[s_{(M_A - M_B)} = \sqrt{\frac{s_p^2}{n_1} + \frac{s_p^2}{n_1}}\]
\[s_{(M_A - M_B)} = \sqrt{\frac{7.97}{6} + \frac{7.97}{6}}\]
\[s_{(M_A - M_B)} = \sqrt{1.33 + 1.33}\]
\[s_{(M_A - M_B)} = \sqrt{2.66}\]
\[s_{(M_A - M_B)} = {1.63}\]

Calculate \(t_{obt}\)
\[t_{obt} = {\frac{(M_A - M_B) - (\mu_A - \mu_B)}{s_{(M_A - M_B)}}}\]
\[t_{obt} = \frac{(14.83 - 13.17) - {0}}{1.63}\]
\[t_{obt} = \frac{1.66}{1.63}\]
\[t_{obt} = {1.02}\]

Calculate Cohen’s d
\[d = \frac{M_A - M_B}{\sqrt{s_p^2}}\]
\[d = \frac{(14.83 - 13.17)}{{{\sqrt{7.97}}}}\]
\[d = \frac{(1.66)}{2.82}\]
\[d = {0.59}\]

The results:

fail to reject the null hypothesis, results not significant,
t(10) = 1.02, p > 0.01, d = 0.59

5.4 Problem 3

Given the following between-subjects data, is the mean of \(Group_A\) significantly different from the mean of \(Group_B\)? Use a \({2}\) tailed-test with \(\alpha = {0.01}\)

A B
24 23
29 23
17 19
33 20
34 17
31 32
30 15
27 20
33 19
26 22
26 23
29 35
34 26


The necessary summary Statistis for these data:
\[M_A = {28.69}, M_B = {22.62}\] \[SS_A = {276.77}, SS_B = {383.08}\] \[n_A = {13}, n_B = {13}\]

State the Hypotheses
\[H_0: \mu_A - \mu_B = 0\] \[H_1: \mu_A - \mu_B \ne 0\]


The decision criteria:

\(t_{crit} = \pm{2.8}, \alpha_{two-tailed} = {0.01}, df = {24}\)

Calculate the pooled variance:
\[s_p^2 = {\frac{SS_A + SS_B}{df_A + df_B}}\]
\[s_p^2 = {\frac{276.77 + 383.08}{12 + 12}}\]
\[s_p^2 = \frac{659.85}{24}\]
\[s_p^2 = {27.49}\]

Calculate the estimated error of the difference between means: \(s_{(M_A - M_B)}\)
\[s_{(M_A - M_B)} = \sqrt{\frac{s_p^2}{n_1} + \frac{s_p^2}{n_1}}\]
\[s_{(M_A - M_B)} = \sqrt{\frac{27.49}{13} + \frac{27.49}{13}}\]
\[s_{(M_A - M_B)} = \sqrt{2.11 + 2.11}\]
\[s_{(M_A - M_B)} = \sqrt{4.22}\]
\[s_{(M_A - M_B)} = {2.05}\]

Calculate \(t_{obt}\)
\[t_{obt} = {\frac{(M_A - M_B) - (\mu_A - \mu_B)}{s_{(M_A - M_B)}}}\]
\[t_{obt} = \frac{(28.69 - 22.62) - {0}}{2.05}\]
\[t_{obt} = \frac{6.07}{2.05}\]
\[t_{obt} = {2.96}\]

Calculate Cohen’s d
\[d = \frac{M_A - M_B}{\sqrt{s_p^2}}\]
\[d = \frac{(28.69 - 22.62)}{{{\sqrt{27.49}}}}\]
\[d = \frac{(6.07)}{5.24}\]
\[d = {1.16}\]

The results:

reject the null hypothesis, results are significant,
t(24) = 2.96, p < 0.01, d = 1.16

5.5 Problem 4

Given the following between-subjects data, is the mean of \(Group_A\) significantly less than the mean of \(Group_B\)? Use a \({1}\) tailed-test with \(\alpha = {0.05}\)

A B
41 65
30 57
33 77
59 72
69 68
44 66
37 80
73 76
53 43
43 73
41 80
74 53
64 80
41 49


The necessary summary Statistis for these data:
\[M_A = {50.14}, M_B = {67.07}\] \[SS_A = {2937.71}, SS_B = {1950.93}\] \[n_A = {14}, n_B = {14}\]

State the Hypotheses
\[H_0: \mu_A - \mu_B \geq 0\] \[H_1: \mu_A - \mu_B \lt 0\]


The decision criteria:

\(t_{crit} = {-1.71}, \alpha_{one-tailed} = {0.05}, df = {26}\)

Calculate the pooled variance:
\[s_p^2 = {\frac{SS_A + SS_B}{df_A + df_B}}\]
\[s_p^2 = {\frac{2937.71 + 1950.93}{13 + 13}}\]
\[s_p^2 = \frac{4888.64}{26}\]
\[s_p^2 = {188.02}\]

Calculate the estimated error of the difference between means: \(s_{(M_A - M_B)}\)
\[s_{(M_A - M_B)} = \sqrt{\frac{s_p^2}{n_1} + \frac{s_p^2}{n_1}}\]
\[s_{(M_A - M_B)} = \sqrt{\frac{188.02}{14} + \frac{188.02}{14}}\]
\[s_{(M_A - M_B)} = \sqrt{13.43 + 13.43}\]
\[s_{(M_A - M_B)} = \sqrt{26.86}\]
\[s_{(M_A - M_B)} = {5.18}\]

Calculate \(t_{obt}\)
\[t_{obt} = {\frac{(M_A - M_B) - (\mu_A - \mu_B)}{s_{(M_A - M_B)}}}\]
\[t_{obt} = \frac{(50.14 - 67.07) - {0}}{5.18}\]
\[t_{obt} = \frac{-16.93}{5.18}\]
\[t_{obt} = {-3.27}\]

Calculate Cohen’s d
\[d = \frac{M_A - M_B}{\sqrt{s_p^2}}\]
\[d = \frac{(50.14 - 67.07)}{{{\sqrt{188.02}}}}\]
\[d = \frac{(-16.93)}{13.71}\]
\[d = {-1.23}\]

The results:

reject the null hypothesis, results are significant,
t(26) = -3.27, p < 0.05, d = -1.23

5.6 Problem 5

Given the following between-subjects data, is the mean of \(Group_A\) significantly different from the mean of \(Group_B\)? Use a \({2}\) tailed-test with \(\alpha = {0.05}\)

A B
15 26
12 9
15 29
14 20
26 11
23 15
13 10
27 12


The necessary summary Statistis for these data:
\[M_A = {18.12}, M_B = {16.5}\] \[SS_A = {264.88}, SS_B = {410.0}\] \[n_A = {8}, n_B = {8}\]

State the Hypotheses
\[H_0: \mu_A - \mu_B = 0\] \[H_1: \mu_A - \mu_B \ne 0\]


The decision criteria:

\(t_{crit} = \pm{2.14}, \alpha_{two-tailed} = {0.05}, df = {14}\)

Calculate the pooled variance:
\[s_p^2 = {\frac{SS_A + SS_B}{df_A + df_B}}\]
\[s_p^2 = {\frac{264.88 + 410.0}{7 + 7}}\]
\[s_p^2 = \frac{674.88}{14}\]
\[s_p^2 = {48.21}\]

Calculate the estimated error of the difference between means: \(s_{(M_A - M_B)}\)
\[s_{(M_A - M_B)} = \sqrt{\frac{s_p^2}{n_1} + \frac{s_p^2}{n_1}}\]
\[s_{(M_A - M_B)} = \sqrt{\frac{48.21}{8} + \frac{48.21}{8}}\]
\[s_{(M_A - M_B)} = \sqrt{6.03 + 6.03}\]
\[s_{(M_A - M_B)} = \sqrt{12.06}\]
\[s_{(M_A - M_B)} = {3.47}\]

Calculate \(t_{obt}\)
\[t_{obt} = {\frac{(M_A - M_B) - (\mu_A - \mu_B)}{s_{(M_A - M_B)}}}\]
\[t_{obt} = \frac{(18.12 - 16.5) - {0}}{3.47}\]
\[t_{obt} = \frac{1.62}{3.47}\]
\[t_{obt} = {0.47}\]

Calculate Cohen’s d
\[d = \frac{M_A - M_B}{\sqrt{s_p^2}}\]
\[d = \frac{(18.12 - 16.5)}{{{\sqrt{48.21}}}}\]
\[d = \frac{(1.62)}{6.94}\]
\[d = {0.23}\]

The results:

fail to reject the null hypothesis, results not significant,
t(14) = 0.47, p > 0.05, d = 0.23